package com.feicheng.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.feicheng.entity.Stock;
import com.feicheng.mapper.StockMapper;
import com.feicheng.model.StockAndProduct;
import com.feicheng.service.IStockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhennan.liu
 * @since 2022-07-04
 */
@Service
public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements IStockService {

    //依赖注入
    @Autowired
    private StockMapper stockMapper;

    /**
     * 通过产品id和仓库id查询 一个库存对象
     * @author zhennan.liu
     * @param productId
     * @param warehouseId
     * @return
     */
    @Override
    public Stock selectAllByid(Integer productId, Integer warehouseId) {
        Stock stock = stockMapper.selectAllByid(productId, warehouseId);
        return stock;
    }

    /**
     * <p>
     * 服务类
     * </p>
     *
     * @param page
     * @param wrapper
     * @author hao.zhang
     * @since 2022-07-04
     */
    @Override
    public Page<StockAndProduct> getPotionPages(Page<StockAndProduct> page, Wrapper wrapper) {
        return this.getBaseMapper().selectstock(page,wrapper);
    }
}
